package com.mz.util;

import java.io.Serializable;
import java.util.List;

public class PagerData<T> implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -447422313976208009L;
	private Integer totalRecords;
	private Integer totalPages;
	private Integer pageIndex;
	private Integer pageSize;
	private List<T> pageData;
	public Integer getTotalRecords() {
		return totalRecords;
	}
	public void setTotalRecords(Integer totalRecords) {
		this.totalRecords = totalRecords;
	}
	public Integer getTotalPages() {
		return totalPages;
	}
	public void setTotalPages() {
		this.totalPages = this.totalRecords/this.pageSize;
		if(this.totalRecords % this.pageSize != 0){
			this.totalPages ++;
		}
	}
	public Integer getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
		if(this.pageIndex < 1){
			this.pageIndex = 1;
		}
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
		if(this.pageSize < 1 || this.pageSize > 10){
			this.pageSize = 10;
		}
	}
	public List<T> getPageData() {
		return pageData;
	}
	public void setPageData(List<T> pageData) {
		this.pageData = pageData;
	}
	public PagerData(Integer totalRecords, Integer totalPages, Integer pageIndex, int pageSize, List<T> pageData) {
		this.totalRecords = totalRecords;
		this.totalPages = totalPages;
		this.pageIndex = pageIndex;
		this.pageSize = pageSize;
		this.pageData = pageData;
	}
	public PagerData() {
		// TODO Auto-generated constructor stub
	}
	
}
